home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d13
/
devsta32.arc
/
DEVSTA32.ASM
< prev
next >
Wrap
Assembly Source File
|
1986-11-21
|
9KB
|
237 lines
;DEVSTA - program to list out device drivers
; usage is: DEVSTA
; OK in DOS 2.1-3.1 breaks in DOS 3.2
; dissasembly by A. B. Krueger from DEVSTA.EXE
; corrected erronious printing of device names containing '$'
; such as CLOCK$
page 65,132
LF EQU 0AH
CR EQU 0DH
S0000 SEGMENT
ASSUME DS:S0000,CS:S0000
org 100h ;com file format
begin proc far
jmp start
L0110 EQU $
nul_msg db cr,lf,'Failed opening NUL '
db ' Device.'
db cr,lf,'$'
release_msg db cr,lf,'Requires DOS Version'
db ' 2 or greater.'
db cr,lf,'$'
end_msg db 'End of device chain reached'
DB '.',cr,lf,'$'
heading_msg db cr,lf,'Device Driver',cr,lf
DB 'Addr'
DB ' '
DB ' '
db ' Attr'
db ' Str '
db ' Int '
Db ' '
db 'Type'
DB ' '
db 'Units'
DB ' '
db 'Name'
DB cr,lf,'$'
print_line:
print_es db 'XXXX'
db ':'
print_bx db 'XXXX'
db ' '
print_attr db 'XXXX'
db ' '
print_str db 'XXXX'
db ' '
print_int db 'XXXX'
Db ' '
print_type db 'X '
Db ' '
Db ' '
print_units db 'XX'
Db ' '
Db ' '
print_name Db 'XXXXXXXX'
db cr,lf
nul_fcb db 0,'NUL '
Db ' '
Dw 14 dup (0)
start:
MOV AH,30h ;get DOS release
INT 21h
CMP AL,2 ;at least DOS 2.0
JNB Dos_ok ;if so, go on
MOV DX,offset release_msg
JMP SHORT exit_msg
Dos_ok: MOV CX,AX
MOV AH,0Fh ;open FCB
MOV DX,OFFSET Nul_fcb
L0020: INT 21h
OR AL,AL ;did it run
L0024: JZ Got_nul
MOV DX,offset nul_msg
JMP exit_msg
Got_nul: CMP CL,2h ;release 2?
JA release_3x
release_2:
MOV BX,word ptr nul_fcb+0dch-0c3h ;set es:bx for dos 2.1
MOV ES,word ptr nul_fcb+0deh-0c3h
JMP release_join
release_3x:
cmp ch,10h
ja release_32
MOV BX,word ptr nul_fcb+0ddh-0c3h ;set es:bx for dos 3.1
MOV ES,word ptr nul_fcb+0dfh-0c3h
JMP release_join
release_32:
mov BX,48h ;set es:bx for dos 3.2
MOV ES,word ptr nul_fcb+1Ch
JMP release_join
release_join:
CALL Type_heading
Dev_loop:
CALL Format_dev
LES BX,DWORD PTR ES:[BX] ;get next pointer
CMP BX,-1 ;end of chain?
JNZ dev_loop
MOV DX,OFFSET End_msg
exit_msg: MOV AH,9h
INT 21h
int 20h
begin endp
Type_heading proc near
MOV DX,OFFSET heading_msg ;l005f
MOV AH,9
INT 21h
RET
type_heading endp
Format_dev proc near
MOV AX,ES
MOV DI,OFFSET print_es
CALL Bin_hex_word
MOV AX,BX
MOV DI,OFFSET print_bx
CALL Bin_hex_word
MOV AX,ES:[BX+4h]
PUSH AX
MOV DI,offset print_attr
CALL Bin_hex_word
MOV AX,ES:[BX+6h]
MOV DI,offset print_str
CALL Bin_hex_word
MOV AX,ES:[BX+8h]
MOV DI,offset print_int
CALL Bin_hex_word
POP AX
TEST AX,8000h
JNZ format_only
MOV word ptr print_name,0d0ah
MOV AL,ES:[BX+0Ah]
AAM
ADD AX,'00'
MOV print_units+1,al
MOV print_units,ah
MOV BYTE PTR print_type,'B'
MOV cx,print_name+2-print_line
JMP Format_print
format_only:
XOR SI,SI
format_type:
MOV AL,ES:[BX+SI+0Ah]
MOV [SI+offset print_name],AL
INC SI
CMP SI,08h
JNZ format_type
MOV WORD PTR print_units,' '
MOV BYTE PTR print_type,'C'
MOV cx,print_name+10-print_line
Format_print:
mov si,offset print_line
format_loop:
lodsb
mov dl,al
MOV AH,6 ;type on console
INT 21h
loop format_loop
RET
format_dev endp
Bin_hex_word proc near
PUSH AX
MOV AL,AH
CALL Bin_hex_byte
L00DD: ADD DI,2
POP AX
CALL Bin_hex_byte
RET
bin_hex_word endp
Bin_hex_byte proc near
MOV AH,AL
MOV CX,4
SHR AL,CL
CALL Bin_hex_nibl
MOV [DI],AL
MOV AL,AH
AND AL,0Fh
CALL Bin_hex_nibl
MOV [DI+1],AL
RET
bin_hex_byte endp
Bin_hex_nibl proc near
ADD AL,30h ;'0'
CMP AL,39h ;'9'
JLE L0104
ADD AL,7
L0104:
RET
bin_hex_nibl endp
s0000 ends
END begin